<style>
    .radio-input div{
        float: left;
        margin-left: .5em;
    }
</style>
<?php
if(isset($form['#distributor_id']) && !empty($form['#distributor_id'])){
    echo get_template_header_info($form['#distributor_id'],'distributor');
}
?>
<div class="hp-tab-newprd">
    <ul class="j-sw-nav">
        <?php if(empty($_GET['distributor_id'])){?>
            <li class="newprd-s1 tab-li"><a href="<?php echo base_path();?>sales/invoice/list">查看</a></li>
            <?php if(user_access('add invoice')){?>
            <li class="newprd-s2 tab-li<?php if(arg(2) == 'add'){?> on <?php }?>"><a href="<?php echo base_path();?>sales/invoice/add">添加</a></li>
            <?php } if(user_access('view invoice stats')){?>
            <li class="newprd-s3 tab-li"><a href="<?php echo base_path();?>sales/invoice/stats">统计</a></li>
            <?php } if(arg(2) == 'edit' && !empty(arg(3))){?>
                <li class="newprd-s3 tab-li on"><a href="javascript:void(0)">修改</a></li>
            <?php }
        }else{?>
            <?php echo get_tab($form['#distributor_id'],'invoice','distributor')?>
        <?php } ?>
    </ul>
    <div class="table-div">
        <?php if(isset($form['#distributor_id'])&& !empty($form['#distributor_id'])){?>
            <ul class="table-ul-li">
                <li><a href="<?php echo base_path(); ?>sales/invoice/list?distributor_id=<?php echo $form['#distributor_id']?>">列表</a></li>
                <?php if(user_access('add invoice')){?>
                <li>|</li>
                <li><a href="<?php echo base_path(); ?>sales/invoice/add?distributor_id=<?php echo $form['#distributor_id']?>" <?php if(arg(2) == "add" && !empty($_GET['distributor_id'])){?>class="selected"<?php }?>>添加</a></li>
                <?php }
                if(arg(2) == "edit" && !empty($_GET['distributor_id'])){?>
                    <li>|</li>
                    <li class="selected">详情</li>
                <?php }?>
            </ul>
        <?php }?>
        <div class="small-select small-input column" style="clear:both">
            <div style="width: 500px;"><div class="form-label">开票日期:</div><?php print render($form['invoice_date']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>发票编号:</div><?php print render($form['invoice_id']); ?></div>
        </div>
            <div class="max-big-input column" style="clear:both">
                    <div class="address-search" <?php  if(isset($_GET['distributor_id']) && !empty($_GET['distributor_id'])) {  echo "style='display: none'"; } ?>>
                        <div class="form-label"><span class="required">*</span>请选经销商:</div>
                        <?php print render($form['distributor_name']);
                        print render($form['select_distributor_button']);
                        ?>
                    </div>
            </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label">销售员:</div><?php print render($form['employee_list']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label">销售类型:</div><?php print render( $form['sales_type']); ?></div>

        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>化肥品种:</div><?php print render($form['sacfvariety']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>数量:</div><?php print render($form['quantity']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <?php  print _address_render_for_add($form)?>
        </div>
        <div class="small-select column" style="clear:both">
            <div class="small-div small-input"><div class="form-label">到站地名:</div><?php print render( $form['station']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-input small-div"><div class="form-label">路局:</div><?php print render($form['railway']); ?></div>
        </div>
        <div class="small-select column" style="clear:both">
            <div class="radio-input"><div class="form-label">关内/关外:</div><?php print render($form['inorout']); ?></div>
        </div>
        <div class="add-submit" style="text-align: center; clear: both"><?php print render($form['submit']); ?></div>
    </div>
</div>
<?php print drupal_render_children($form); ?>
</div></form>
<div>
    <div class="modal fade" id="distributorModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        选择经销商
                    </h4>
                </div>
                <div class="modal-body">
                    <?php echo @render(drupal_get_form('distributor_select_list_form'),$_GET['addr_id']?$_GET['addr_id']:'');?>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>

                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<form><div>
